package edu.scau.divineplace.controller;

import edu.scau.divineplace.config.global.log.WebLog;
import edu.scau.divineplace.entity.query.PageQuery;
import edu.scau.divineplace.entity.vo.FavoriteContentVO;
import edu.scau.divineplace.service.FavoriteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: x1aolone
 * @Date: 2020/12/11 15:47
 */
@Slf4j
@RestController
@CrossOrigin
@Api("Favorite控制器")
@WebLog("Favorite控制器")
@RequestMapping("/favorite")
public class FavoriteController {

    @Autowired
    private FavoriteService favoriteService;

    @ApiOperation("通过用户id、收藏类型获取该用户收藏的内容列表（人物除外），支持完美分页")
    @GetMapping("/contentExpectRole/list/{userId}")
    public List<FavoriteContentVO> listFavoriteContentExpectRole(@PathVariable Long userId, Integer favoriteType, PageQuery pageQuery){
        return favoriteService.listFavoriteContentExpectRole(userId, favoriteType, pageQuery);
    }

    @ApiOperation("通过用户id、是否真实人物获取该用户收藏的人物列表，支持完美分页")
    @GetMapping("/role/list/{userId}")
    public List<FavoriteContentVO> listFavoriteRole(@PathVariable Long userId, Integer isReal, Integer currentPage, Integer pageSize){
        return favoriteService.listFavoriteRole(userId, isReal, currentPage, pageSize);
    }

}
